<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>新闻推送</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8">
    <meta name="keywords" content="" />
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    <meta name="viewport" content="width=device-width,  initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,  user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <!-- bootstrap-css -->
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
    <!--// bootstrap-css -->
    <!-- css -->
    <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
    <!--// css -->
    <!-- font-awesome icons -->
    <link href="css/font-awesome.css" rel="stylesheet">
    <!-- //font-awesome icons -->
    <link rel="stylesheet" href="css/simplePaging.css">
    <style>
        /*当前页面样式*/
        * {
            margin: 0;
            padding: 0;

        }
        body {
            position: relative;
            font: 14px/1.42857143 'Microsoft YaHei', '微软雅黑', '宋体';
            color: #333;
            background-color: #fff;
            min-width: 1220px;
            max-width: 1920px;
            margin: 0 auto;
        }

        .part {
            width: 480px;
            margin: 10px;
            padding: 10px;
            overflow: hidden;
            border: 1px solid #ccc;
        }

        .part p {
            padding-left: 2px;
        }
        .red{
            color: red;
        }
        .page{
            height: 20px;
            line-height: 20px;
        }
        .page:before{
            content: "回调显示页码：";
            color: red;
        }
        pre{
            display: block;
            background-color: #ececec;
            margin-top: 10px;
            overflow: hidden;
        }
        .title{
            color: #f90;
            margin-bottom: 2px;
        }
        .showPage{
            border: 1px solid #333;
        }
        .showPage div{
            background-color: #ccc;
            margin-top: 2px;
        }
        .showPage div:first-child{
            margin-top: 0;
        }

        .showPage2{
            border: 1px solid #333;
        }
        .showPage2 div{
            background-color: #ccc;
            margin-top: 2px;
        }
        .showPage2 div:first-child{
            margin-top: 0;
        }
        .reward{
            position: fixed;
            bottom: 0;
            right: 0;
        }
        .reward button{
            padding: 5px;
            font-size: 16px;
            border: none;
            background-color: #9bf49f;
            cursor: pointer;
        }

    </style>
    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/bootstrap.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(".scroll").click(function(event){
                event.preventDefault();
                $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
            });
        });
    </script>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
</head>
<body id="body">
<!-- banner -->
<div class="banner jarallax">
    <div class="banner-dot">
        <div class="header-top">
            <div class="container">
                <div class="header-top-left">
                    <p><i class="fa fa-home" aria-hidden="true"></i>  西永大道 , 重庆沙坪坝</p>
                </div>
                <div class="header-top-right">
                    <p><i class="fa fa-phone" aria-hidden="true"></i> +114514</p>
                </div>
            </div>
        </div>
        <div class="header">
            <div class="container">
                <div class="header-left">
                    <div class="w3layouts-logo">
                        <h1>

                            <a href="/front/indexs">汽车时代</a>

                        </h1>
                    </div>
                </div>
                <div class="clearfix"> </div>
            </div>
        </div>

        <div class="header-right about-top">
            <div class="container">
                <div class="top-nav">
                    <nav class="navbar navbar-default">
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                        </div>
                        <!--navbar-header-->
                        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="/front/indexs" class="active">首页</a></li>
                                <li><a href="/front/about">关于我们</a></li>
                                <li><a href="/front/gallery">汽修产品</a></li>
                                <li class=""><a href="#" class="dropdown-toggle hvr-bounce-to-bottom" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">预约服务<span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a class="hvr-bounce-to-bottom" href="/front/contact">在线预约</a></li>
                                        <li><a class="hvr-bounce-to-bottom" href="#">上门检修</a></li>
                                    </ul>
                                </li>
                                <li><a href="/front/blog">信息中心</a></li>
                                <li class=""><a href="#" class="dropdown-toggle hvr-bounce-to-bottom" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">联系我们<span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a class="hvr-bounce-to-bottom" href="/front/recruitment">精英招聘</a></li>
                                        <li><a class="hvr-bounce-to-bottom" href="/front/CustomerMessage">客户留言</a></li>
                                    </ul>
                                </li>
                            </ul>
                            <div class="clearfix"> </div>
                        </div>
                    </nav>
                </div>
                <div class="clearfix"> </div>
            </div>
        </div>
        <div class="wthree-heading">
            <h2>新闻推送</h2>
        </div>
    </div>
</div>
<!-- //banner -->
<!-- blog -->
<div class="blog" >
    <div class="container">

        <div class="agile-blog-grids">
            <div class="col-md-8 agile-blog-grid-left" id="news">

            </div>
            <div class="col-md-4 agile-blog-grid-right">
                <div class="categories">
                    <h3>热点新闻</h3>
                    <ul id="LastUi">

                    </ul>
                </div>
                <div class="categories">
                    <h3>往期回顾</h3>
                    <ul class="marked-list offs1">
                        <li><a href="#">May 2017 (7)</a></li>
                        <li><a href="#">April 2017 (11)</a></li>
                        <li><a href="#">March 2017 (12)</a></li>
                        <li><a href="#">February 2017 (14)</a> </li>
                        <li><a href="#">January 2017 (10)</a></li>
                        <li><a href="#">December 2017 (12)</a></li>
                        <li><a href="#">November 2017 (8)</a></li>
                        <li><a href="#">October 2017 (7)</a> </li>
                        <li><a href="#">September 2017 (8)</a></li>
                        <li><a href="#">August 2017 (6)</a></li>
                    </ul>
                </div>
            </div>
            <div class="clearfix"> </div>
                <div class="showPagePaging" style="margin: 5px ;float: left"></div>
        </div>
    </div>
</div>
<!-- //blog -->
<!-- footer -->
<div class="w3-agile-footer">
    <div class="container">
        <div class="footer-grids">
            <div class="col-md-3 footer-grid">
                <div class="footer-grid-heading">
                    <h4>地址</h4>
                </div>
                <div class="footer-grid-info">
                    <p>恒达汽修有限公司
                        <span>地　址：重庆市万州区厦门路602号</span>
                    </p>
                    <p class="phone">电　话：020-5856-1762
                        <span>Email : <a href="mailto:wuhongyacao@outlook.com">wuhongyacao@outlook.com</a></span>
                    </p>
                </div>
            </div>


            <div class="col-md-3 footer-grid">
                <div class="footer-grid-heading">
                    <h4>Follow</h4>
                </div>
                <div class="social">
                    <ul>
                        <li><a href="#"><i class="fa fa-facebook"></i></a></li>
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-rss"></i></a></li>
                        <li><a href="#"><i class="fa fa-vk"></i></a></li>
                    </ul>
                </div>
            </div>
            <div class="clearfix"> </div>
        </div>
        <div class="agileits-w3layouts-copyright">
            <p>Copyright &copy; 2018.Company name All rights reserved.Technical support by Takahashi Wuu</p>
        </div>
    </div>
</div>
<!-- //footer -->
<script src="js/jarallax.js"></script>
<script src="js/SmoothScroll.min.js"></script>
<script type="text/javascript">
    /* init Jarallax */
    $('.jarallax').jarallax({
        speed: 0.5,
        imgWidth: 1366,
        imgHeight: 768
    })
</script>

<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script src="http://www.jq22.com/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.poshytip.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<!-- 解决日期格式问题 -->
<script type="text/javascript">
    function formatDate(val) {
        var date = new Date(val);
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        var d = date.getDate();
        return y + '-' + m + '-' + d;
    }
</script>
<script type="text/javascript">
    function loadData(page) {
        $("#news").empty();
        $.ajax({
            url: "/front/news/queryList",
            data: {"page": page},
            type: "POST",
            cache: false,
            async: false,
            dataType: "json",
            success: function (data) {
                console.log(data)
                if (data.news.success) {
                    var newsList = data.news.data;
                    for (var i = 0; i < newsList.list.length; i++) {
                        var newsObj = newsList.list[i];
                        $("#news").append("<div class='agile-blog-grid'>" +
                            " <div class='agile-blog-grid-left-img'><a href='/news/queryById?id="+newsObj.newid+"'><img src='" + newsObj.newpic + "' alt='' /></a></div>" +
                            "<div class='blog-left-grids'><div class='blog-left-left'><i class='fa fa-pencil' aria-hidden='true'></i></div>" +
                            "<div class='blog-left-right'><div class='blog-left-right-top'><h4><a href='/news/queryById?id="+newsObj.newid+"'>" + newsObj.newhead + "</a></h4>" +
                            "<p>Posted By <a href='/news/queryById?id="+newsObj.newid+"'>" + newsObj.newadmin + "</a> &nbsp;&nbsp;"+formatDate(newsObj.newdate)+"&nbsp;&nbsp; </p></div>" +
                            "<div class='blog-left-right-bottom'><p>" + newsObj.newcont + "  </p><a href='/single'>More</a></div></div> <div class='clearfix'> </div>" +
                            "</div></br>")
                    }
                    $("#news").append("");

                } else {
                    $("#news").append("<div>没有更多的了...</div>")
                }
                goalPage = data.news.data.pages;
            }

        });
    }
</script>
<script src="js/simplePaging.min.js"></script>
<script src="js/simplePaging.js"></script>
<script>
    loadData(1);
    $(".showPagePaging").simplePaging({
        allPage: goalPage,//总页数
        showPage: 5,//显示页数
        startPage: 1,//第一页页码数字
        initPage: 1,//加载完毕自动跳转到第n页(初始化激活页)
        initPageClick:true,//每次页面加载完毕后，是否触发initPage页的绑定事件
        first: "首页",//首页显示字符
        last: "尾页",//尾页显示字符
        prev: "«",//上一页显示字符
        next: "»",//下一页显示字符
        showTurnTo: true,//是否显示跳转按钮，true显示，false不显示
        animateType: "animation",//过渡模式：动画“animation”、跳动“jumpy”、快速移动“fast”、正常速度移动“normal”、缓慢的速度移动“slow”、异常缓慢的速度移动“verySlow”
        animationTime: 300,//animateType为animation时，动画过渡时间(ms)
        callBack: function (num) {
            loadData(num)
        }
    })
</script>
<script type="text/javascript">
    $().ready(function() {
        $.ajax({
            url: "/front/news/queryLast",
            type: "POST",
            cache: false,
            dataType: "json",
            success: function (data) {
                console.log(data);
                if(data.success){
                    for(var i = 0; i<data.data.length;i++){
                        $("#LastUi").append(" <li><a href='/news/queryById?id="+data.data[i].newid+"'>"+data.data[i].newhead+"</a></li>")
                    }
                }else{
                    $("#LastUi").append(" <li><a href='#'>最近还没有什么新闻哦！</a></li>");
                }
            }
        });
    })
</script>

<script src="js/owl.carousel.js"></script>
</body>
</html>
